package Java道题;

public class A_2A_3A {
    //用1~9组成3个三位数，每个数字使用一次使得abc：def：ghi=1:2:3，输出所有解
    static void numbernozero() {
        int j;
        for (int i = 100; i < 1000 / 3; i++) {
            String a = Integer.toString(i);
            String b = Integer.toString(2 * i);
            String c = Integer.toString(3 * i);
            for (j = 0; j < 3; j++) {
                if (String.valueOf(a.charAt(j)).equals("0")) {
                    break;
                }
                if (String.valueOf(b.charAt(j)).equals("0")) {
                    break;
                }
                if (String.valueOf(c.charAt(j)).equals("0")) {
                    break;
                }
            }
            if (j == 3) {
                System.out.println(a + " " + b + " " + c);
            }
        }
    }

    static void numberzeroarr() {
        char[] num = {'1', '2', '3', '4', '5', '6', '7', '8', '9'};
        String a = null, b = null, c = null;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 9; j++) {
                for (int k = 0; k < 9; k++) {
                    a = String.valueOf(num[i]) + String.valueOf(num[j]) + String.valueOf(num[k]);
                    b = String.valueOf(Integer.parseInt(a) * 2);
                    c = String.valueOf(Integer.parseInt(a) * 3);
                    //System.out.println(a);
                }
            }
        }


    }

    public static void main(String[] args) {


        // TODO Auto-generated method stub

        numbernozero();
        //numberzeroarr();

    }
}
